/**
 * @author caiqian
 * @Company Mtic
 * @date 2021/9/1
 */
public class Client {

    /**
     * 场景实例：
     * 　　报社送报纸给订阅者
     * 　　只要是订阅了人民日报的人，有了新报纸就会送到订阅者那里去，当你不想订的时候取消就不订阅就不会再收到报纸了。
     *
     * @param args
     */

    public static void main(String[] args) {
        System.out.println("demo");
        PeopleNewsPaper peopleNewsPaper = new PeopleNewsPaper();
        SubHuman _XiaoMing = new SubHuman("小明");
        SubHuman _ZhaoYun = new SubHuman("赵云");
        SubHuman _LiuBei = new SubHuman("刘备");
        //小明订报
        peopleNewsPaper.addSubscriber(_XiaoMing);
        //赵云订报
        peopleNewsPaper.addSubscriber(_ZhaoYun);
        //刘备订报
        peopleNewsPaper.addSubscriber(_LiuBei);
        //有新报纸了
        peopleNewsPaper.sendNewsPaper();
        System.out.println("---------------发完报纸了------------------");

        //小明不想订了，取消报纸
        peopleNewsPaper.removeSubScriber(_XiaoMing);
        //又有新报纸了  就没有小明的报纸 了
        peopleNewsPaper.sendNewsPaper();
    }
}
